﻿using FFIV.Lib.Controlers.Articles;
using FFIV.Lib.Model;
using FFIV.Lib.Utilities;
using FFIV.Lib.WebExtension;

public partial class Articles_List : FFWebPageBase
{
	private ListController m_Controller;

	protected override void InitialFileds()
	{
		m_Controller = new ListController(uc_DetailCategory, uc_ArticlesList);
		uc_ArticlesList.PageSize = 15;
	}

	protected override void BindingEvents()
	{
		uc_ArticlesList.RegistEvents();
	}

	public override void ShowMessage()
	{
		m_Controller.LoadPage();
		LoadHtmlHeader();
		LoadMainTitle();

	}

	public override Permissions RequiredPermission
	{
		get { return Permissions.Anonymous; }
	}

	public void LoadHtmlHeader()
	{
		uc_HtmlHeader.HeaderInfo = m_Controller.GetHtmlInfo();
	}

	private void LoadMainTitle()
	{
		int categoryId = ParamUtility.GetQueryStringValue("id", 1);
		CategoryNode category = CategoriesUtility.GetCategoryNodeById(categoryId);
		if (category!= null)
		{
			uc_ArticlesList.MainTitle = string.Format("{0} - 文章列表", category.Name);
		}
	}
}
